home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / COM / LineShare 3.3.1 folder.sit / LineShare 3.3.1 folder / LineShare 3.3.1 / LineShare Scripts / MaxFax&ARA&Data < prev    next >
Text File  |  1995-03-10  |  6KB  |  347 lines

  1. ! Version 3.0.4
  2. !
  3. !$ Use this script with Class 2 MaxFax voice software version 3.5 and higher,
  4. !$ ARA 1.0 or 2.0,
  5. !$ and a BBS, E-mail or other communication server software
  6. !
  7. !$ A cable for hardware handshaking is required
  8.  
  9. ^# Modem:
  10. ^2 Handshake wires: = Bool("CTS+DTR"="&D0","CTS only"="&D2") "&D2"
  11. ^3 Call Progress for Fax: = Bool("Enabled"="","Disabled"="X1") "X1"
  12. ! ------------------------------------------
  13. ! Resetting the modem:
  14. ! ------------------------------------------
  15. @Hangup
  16.   SetTries 2
  17.   Flush
  18.   HsReset 0,0,0,0,0,0
  19. !
  20. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  21. ! to enter the command mode
  22. !
  23. @Label 1
  24.   matchclr
  25.   matchstr 1 2 "OK¥r¥n"
  26.   write "ATH0V1Q0¥r"
  27.   matchread 20
  28.   ChrDelay 1
  29.   Write "+++"
  30.   ChrDelay 0
  31.   DtrClear
  32.   SBreak
  33.   DtrSet
  34. !
  35.   DecTries
  36.   IfTries 0 1
  37. !
  38. ! OSErr -6019 "Modem error - the modem is not responding"
  39. !
  40.   exit -6019
  41. @Label 2
  42.   Write "ATH0¥r"
  43.   Jsr 100
  44.   SetVar A "&F"
  45.   GetOption A "DFLT" 3
  46. @Label 3
  47.   write "AT^A+FCLASS=0¥r"
  48.   Jsr 100
  49.   exit 0
  50.  
  51. @Label 6
  52.   Say "This script cannot be used with this modem"
  53.   ifOriginate 7
  54.   pause 1800
  55. @Label 7
  56.   exit -6019
  57. ! ------------------------------------------
  58. !    Receiving incoming calls
  59. ! ------------------------------------------
  60. @ANSWER
  61. !
  62. ! Set the modem preferred speed first
  63.   SerReset 19200,0,8,1
  64.   Jsr 80
  65. !
  66. ! Set the common options
  67.   Jsr 70
  68.  
  69. @Label 10
  70.   MatchClr
  71.   Matchstr 1 11 "RING¥r¥n"
  72.   MatchRead 1800
  73.   Jump 10
  74.  
  75. @Label 11
  76.   QueueInput "¥r¥nRING¥r¥n"
  77.   Note "Attachingノ" 3
  78.   Attach "MaxFax" (Master,DTR)
  79.   SetVar D "^$"
  80.   Note "Switchingノ" 3
  81. !
  82. ! Set the communication options:
  83. ! ・ Normal (for ARA) /AUTO Connection
  84. ! ・ HW flow control
  85. ! ・ CONNECT <DCE speed> or CARRIER/CONNECT
  86. !
  87.   GetOption A "HWHS" 6
  88.   GetOption B "NORM" 6
  89.   ifStr D 12 "ARA"
  90.   GetOption B "AUTO" 6
  91. @Label 12
  92.   GetOption C "LNRS" 6
  93.   Write "AT^A^B^C+FCLASS=0¥r"
  94.   Jsr 100
  95.   Write "AT+FAA=0¥r"
  96.   Jsr 100
  97.  
  98.   Write "ATA¥r"
  99.   Jsr 90
  100.   IfStr C 13 "DATA"
  101.   exit -6019
  102. @Label 13
  103.   ifStr D 30 "ARA"
  104.   ifStr D 30 "ARA2"
  105. !
  106. ! Regular data connection
  107. !
  108.   HsReset 0,1,0,0,0,1
  109.   ifStr D 40 "Data"
  110.   ifStr D 41 "Data1"
  111.  
  112.   Say "The service '^A' is not supported in the LineShare script"
  113.   exit -6019
  114.  
  115. !
  116. ! ARA connection established
  117. !
  118. @Label 30
  119.   QueueInput "¥r¥nCARRIER ^B¥r¥n"  
  120.   IfStr A 31 "NONE"
  121.   IfStr A 31 "None"
  122.   QueueInput "¥r¥nREL¥r¥n"
  123. @Label 31
  124.   IfOriginate 32
  125.   QueueInput "¥r¥nRING¥r¥n"
  126. @Label 32
  127.   Attach "ARA" (DTR)
  128.  
  129.  
  130. ! ------------------------------------------
  131. ! Originating a call through the "MaxFax" subport
  132. ! ------------------------------------------
  133. @ORIGINATE "MaxFax" ("¥r¥nBusy¥r¥n")
  134.   Note "MaxFax is originating a call ..."
  135.   SerReset *
  136.   Jsr 80
  137.   Jsr 60
  138.   HsReset *
  139.   Write "AT^3D^1¥r"
  140.   MatchClr
  141.   MatchStr 1 35 "+FCON"
  142.   Matchstr 10 82 "BUSY¥r¥n"
  143.   MatchStr 11 83 "NO CARRIER¥r¥n"
  144.   MatchStr 12 84 "NO ANSWER¥r¥n"
  145.   MatchStr 13 81 "NO DIALTONE¥r¥n"
  146.   MatchRead 1200
  147.   Exit -6019
  148. @Label 35
  149.   QueueInput "¥r¥n+FCON"
  150.   Attach "MaxFax" (DTR)
  151.  
  152. ! ------------------------------------------
  153. ! Originating a call through the "ARA" subport
  154. ! ------------------------------------------
  155. @ORIGINATE "ARA"
  156.   SerReset 19200,0,8,1
  157.   Jsr 80
  158. !
  159. ! Set the common options
  160.   Jsr 70
  161. !
  162. ! Set the communication options:
  163. ! ・ Normal Connection
  164. ! ・ HW flow control
  165. ! ・ CONNECT <DCE speed> or CARRIER/CONNECT
  166. !
  167.   GetOption A "HWHS" 6
  168.   GetOption B "NORM" 6
  169.   GetOption C "LNRS" 6
  170.   Write "AT^A^B^C¥r"
  171.   Jsr 100
  172. !
  173. ! dial the number
  174.   Write "ATD^1¥r"
  175. !
  176. ! Wait for a modem response
  177.   Jsr 90
  178.   IfStr C 30 "DATA"
  179.   Write "¥r"
  180.   Exit -6019
  181.  
  182. ! ------------------------------------------
  183. ! Originating a call through the "DATA" subports
  184. ! ------------------------------------------
  185. @ORIGINATE "Data"
  186.   Jsr 45
  187. @Label 40
  188.   GetSReg C "Data" 4
  189.   Jsr 48
  190.   Attach "Data" (DTR,Escape,Break)
  191.  
  192. @ORIGINATE "Data1"
  193.   Jsr 45
  194. @Label 41
  195.   GetSReg C "Data1" 4
  196.   Jsr 48
  197.   Attach "Data1" (DTR,Escape,Break)
  198.  
  199.  
  200. @Label 45
  201.   Jsr 70
  202.   SerReset *
  203.   GetOption A "HWHS" 6
  204.   GetOption B "AUTO" 6
  205.   GetOption C "LNRS" 6
  206.   Write "AT^A^B^C¥r"
  207.   Jsr 60
  208.   Write "ATD^1¥r"
  209.   HsReset *
  210.   Jsr 90
  211.   IfStr C 46 "DATA"
  212.   Write "¥r"
  213.   Exit -6019
  214. @Label 46
  215.   return
  216.  
  217. @Label 48
  218.   QueueInput "¥r^CCONNECT ^B¥r^C"
  219.   IfOriginate 49
  220.   QueueInput "¥r^CRING¥r^C"
  221. @Label 49
  222.   return
  223.  
  224. !
  225. ! This section emits all modem commands sent from the client application
  226. ! For each set of commands the "OK" answer is awaited
  227. !
  228. @Label 60
  229.   EmitStart
  230. @Label 61
  231.   EmitCommand 62
  232.   Jsr 100
  233.   Jump 61
  234. @Label 62
  235.   return
  236. !
  237. ! This section initiates the modem before ANSWER and ORIGINATEs:
  238. ! reset on Dtr drop + DCD valid
  239. ! Verbal responses mode, no echo 
  240. !
  241. @Label 70
  242.   Write "AT^2&C1V1E0¥r"
  243.   Jsr 100
  244.   return 
  245.  
  246. !
  247. ! This section syncronize the modem after the serial port speed switching
  248. !
  249. @Label 80
  250.   ChrDelay 1
  251.   Write "AT¥r"
  252.   ChrDelay 0
  253.   Jsr 100
  254.   return
  255. !
  256. ! Error codes
  257. @Label 81
  258.   exit -6020
  259. @Label 82
  260.   exit -6022
  261. @Label 83
  262.   exit -6021
  263. @Label 84
  264.   exit -6023
  265.   
  266. !
  267. ! This subroutine waits for the modem response
  268. ! On exit, ^C contains the result code: "FAX" or "DATA"
  269. ! ^A contains the protocol used
  270. ! ^B contains the carrier speed
  271. ! If modem reports an error, the scripts exits with an error code
  272. !
  273. @Label 90
  274.   SetVar C "1200"
  275.   ifOriginate 89
  276.   SetVar C "600"
  277. @Label 89
  278.   SetVar A "NONE"
  279.   SetVar B ""
  280.   MatchClr
  281.   Matchstr 1 92 "CARRIER ^$¥r¥n"
  282.   Matchstr 2 93 "PROTOCOL: ^$¥r¥n"
  283.   Matchstr 3 94 "+FCON"
  284.  
  285.   Matchstr 4 95 "CONNECT ^$/"
  286.   Matchstr 5 97 "CONNECT ^$¥r¥n"
  287.   Matchstr 10 82 "BUSY¥r¥n"
  288.   MatchStr 11 83 "NO CARRIER¥r¥n"
  289.   MatchStr 12 84 "NO ANSWER¥r¥n"
  290.   MatchStr 13 81 "NO DIALTONE¥r¥n"
  291. @Label 91
  292.   Matchread Val("^C")
  293.   SetVar C "NONE"
  294.   return
  295.  
  296. @Label 92
  297.   SetVar B "^$"
  298.   Jump 91
  299. @Label 93
  300.   SetVar A "^$"
  301.   Jump 91
  302. !
  303. ! Fax connection was established
  304. !
  305. @Label 94
  306.   SetVar C "FAX"
  307.   return
  308.  
  309. ! CONNECT xxxx/XXXX was detected
  310. @Label 95
  311.   Jsr 98
  312.   MatchClr
  313.   MatchStr 1 96 "^$¥r¥n"
  314.   MatchRead 10
  315. @Label 96
  316.   SetVar A "^$"
  317.   SetVar C "DATA"
  318.   return
  319.  
  320. ! CONNECT xxx was detected
  321. @Label 97
  322.   Jsr 98
  323.   SetVar C "DATA"
  324.   return
  325.  
  326. @Label 98
  327.   ifStr B 99 ""
  328.   return
  329. @Label 99
  330.   SetVar B "^$"
  331.   return 
  332. !
  333. ! Processing the AT command:
  334. ! OK -> proceed
  335. ! ERROR or TimeOut ->exit -6019
  336. ! It can be called AFTER the "Write" command, since LineShare buffers input
  337. !
  338. @Label 100
  339.   MatchClr
  340.   MatchStr 1 102 "OK¥r¥n"
  341.   MatchStr 2 101 "ERROR¥r¥n"
  342.   MatchRead 20
  343. @Label 101
  344.   Exit -6019
  345. @Label 102
  346.   return
  347.